package com.gm.server.voice;

import com.gm.server.voice.core.ServerSocketCore;
import lombok.extern.log4j.Log4j2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableDiscoveryClient
@Log4j2
public class VoiceApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(VoiceApplication.class, args);
		String serverType = context.getEnvironment().getProperty("config.server-type");
		if ("server".equals(serverType)) {
			// 服务端
			context.getBean(ServerSocketCore.class).startServer();
		} else {
			// 客户端
		}
		log.info("==============[gm-box] [voice] [{}]model start success ===============", serverType);
	}

}
